1. Field of the Invention
The present invention relates to an image processing apparatus, an image processing method, and a recording medium on which an image processing program is recorded, and particularly, to an image processing apparatus and an image processing method which apply a color subtraction process on an original image, and a recording medium on which an image processing program is recorded.
2. Discussion of Related Art
In the case where image data are to be output, conventionally, the number of colors which can be included in the image data is restricted in accordance with the capability of a display apparatus, a print apparatus, or the like. Therefore, methods of applying a color subtraction process on image data have been proposed. Japanese Patent Publication (Kokai) No. HEI8-263635 discloses a color subtraction method in which, for an image that has been read by an image reading section, the frequency of use of each color data used in the image data is counted to produce a color frequency histogram, and a color data of a higher use frequency is registered as a representative color into a table. Japanese Patent Publication (Kokai) No. HEI8-287752 discloses another color subtraction method in which an RGB color space is uniformly divided, and a representative color is selected on the basis of the frequencies of pixels existing in each of the uniformly divided spaces.
In the above-mentioned color subtraction methods of the prior art, only distribution information of color data in a color space is used. When an uneven color region of a relatively large area exists in an image, the frequency of use of particular color values in pixels belonging to the uneven color region is high, and hence emphasis is placed on such color values. By contrast, in the case where a gradation image region has pixels of many different color data values in a local region, which is small in area as compared with the whole image, the color data of pixels included in the gradation image region have a low frequency of use, and therefore the color data values included in the gradation region may not be selected as a representative color.
This will be described in more detail. FIG. 14 shows an original image in which a bar graph and a local gradation region are drawn. The local gradation region 35 is a region where a photograph or gradation is shown and the degree of change of pixel color values is significant. In the bar graph, the image is solid. As shown in a subregion 37, which is obtained by extracting a part 36 of the bar graph, all pixels included in the subregion 37 have the same color value.
FIG. 15 shows a copy of the original image which is obtained by reading the original image shown in FIG. 14 by a reading apparatus, or the like, as electronic data. When the monochromatic original image is read, as electronic data, color unevenness, noises, and the like which are caused depending on the performance of the reading apparatus are added to the produced electronic data. In the reproduced image of FIG. 15, color unevenness occurs in the bar graph, and hence pixels included in a subregion 38 which is obtained by extracting the part 36 of the bar graph do not always have the same color value.
Also when an original itself includes uneven print portions, an image is obtained in which the pixel color values are dispersed even in a region that is originally desired to have a uniform pixel color value.
FIG. 16 shows pixel values of the original image (FIG. 15) which has been input as electronic data by the reading apparatus or the like, in the form of a histogram. Referring to the figure, the histogram, in which the ordinate indicates the frequency and the abscissa indicates the color value, has four large peaks. In increasing order of the frequency of use of the pixel values, the peaks respectively correspond to the pixel values which are mainly included in characters and lines, those which are mainly included in the bar graph portion, those which are mainly included in the gradation region 35, and those which are mainly included in the background portion. Among the four peaks, the peak indicated by the pixel values which are mainly included in the gradation region 35 shows a very low frequency of use as compared with the other three peaks. This is because the gradation region 35 occupies a small area in the original image as seen from the original image shown in FIG. 15. As the area is smaller, the number of pixels is smaller, and hence the frequency in the histogram shown in FIG. 16 is low.
By contrast, the pixel values included in the bar graph portion show a higher frequency of use, and have a wide width. The frequency of the pixel values is high because the bar graph portion occupies a large area in the original image. The pixel values of the peak indicating the bar graph portion have a wide width because, when the original image is read by a reading apparatus, color unevenness, noises, and the like are added to the image within the range of the width of the pixel values.
A color subtraction method of the prior art uses distribution information of pixel values in a color space such as the histogram shown in FIG. 16. Therefore, emphasis is placed on the pixel values included in the bar graph portion and the background portion which are originally monochromatic and to which a small number of colors should be allocated. In contrast, the gradation region 35 in which the degree of change of a pixel value is significant and to which a large number colors should be allocated has a low frequency. Consequently, emphasis is not placed on the pixel values included in the gradation region 35.
FIG. 17 shows results of a color subtraction process which is performed on the original image of FIG. 15 by using a color subtraction method of the prior art. In a gradation region 35xe2x80x2, the gradation is impaired because emphasis is not placed on the pixel values which are to be allocated to that region. By contrast, emphasis is placed on pixel values included in the bar graph portion, and noises and color unevenness remain as they are in the bar graph portion as shown in the subregion 38xe2x80x2 which is obtained by extracting the part 36xe2x80x2 of the bar graph.
This problem is not restricted to a monochromatic image but occurs also in a color image in the same manner.
A color difference means the degree of a difference in hue or brightness among plural colors, and can be obtained from a color difference formula indicating a distance in a color space such as RGB or HSB.
An object of the present invention is to solve the above-discussed problems.
It is an object of the present invention to provide an image processing apparatus and an image processing method that can perform a color subtraction process for removing color unevenness while maintaining gradation of a region which is small in area compared to an original image, and in which the degree of change of a pixel value is significant. The present invention also includes a recording medium on which an image processing program is recorded.
According to one aspect of the present invention, an image processing apparatus comprises means for contracting a first image having a plurality of pixels to produce at least one contracted image having fewer pixels than the first image; means for comparing each of the pixels of the first image to a corresponding pixel in the contracted image; means for registering the pixel data of the first image as a registered data only if said comparing means judges that a color difference between the pixel data of the first image and the corresponding pixel data of the contracted image is larger than a predetermined value; and means for substituting a pixel data of the first image with one of a plurality of registered data only if said comparing means judges that a color difference between the pixel data of the first image and the corresponding pixel data of the contracted image is not larger than the predetermined value.